<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="statusActionsScript" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{statusActionsScriptHome.managed ? 'Edit' : 'Add'} Status actions script</f:facet>





            <s:decorate id="orderField" template="layout/edit.xhtml">
                <ui:define name="label">Order</ui:define>
                <h:inputText id="order"
                       required="true"
                          value="#{statusActionsScriptHome.instance.order}">
                    <a:support event="onblur" reRender="orderField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{statusActionsScriptHome.persist}"
                       disabled="#{!statusActionsScriptHome.wired}"
                       rendered="#{!statusActionsScriptHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{statusActionsScriptHome.update}"
                       rendered="#{statusActionsScriptHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{statusActionsScriptHome.remove}"
                      immediate="true"
                       rendered="#{statusActionsScriptHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/StatusActionsScript.xhtml"
                rendered="#{statusActionsScriptHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty statusActionsScriptFrom ? 'StatusActionsScriptList' : statusActionsScriptFrom}.xhtml"
                rendered="#{!statusActionsScriptHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">

    <rich:tab label="Device actions *" labelClass="required">
    <div class="association" id="deviceActionsParent">

        <h:outputText value="There is no deviceActions associated with this statusActionsScript."
                   rendered="#{statusActionsScriptHome.instance.deviceActions == null}"/>

        <rich:dataTable var="_deviceActions"
                   value="#{statusActionsScriptHome.instance.deviceActions}"
                rendered="#{statusActionsScriptHome.instance.deviceActions != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="deviceActionsTable">
            <h:column>
                <f:facet name="header">Device actions id</f:facet>
                <h:outputText value="#{_deviceActions.deviceActionsId}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Device device id</f:facet>
                <h:outputText value="#{_deviceActions.device.deviceId}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Action type</f:facet>
                <h:outputText value="#{_deviceActions.actionType}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Name</f:facet>
                <h:outputText value="#{_deviceActions.name}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{statusActionsScriptHome.instance.deviceActions != null ? 'changeParent' : 'selectParent'}" value="#{statusActionsScriptHome.instance.deviceActions != null ? 'Change' : 'Select'} deviceActions"
                       view="/DeviceActionsList.xhtml">
                <f:param name="from" value="StatusActionsScriptEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>

    <rich:tab label="Status actions *" labelClass="required">
    <div class="association" id="statusActionsParent">

        <h:outputText value="There is no statusActions associated with this statusActionsScript."
                   rendered="#{statusActionsScriptHome.instance.statusActions == null}"/>

        <rich:dataTable var="_statusActions"
                   value="#{statusActionsScriptHome.instance.statusActions}"
                rendered="#{statusActionsScriptHome.instance.statusActions != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="statusActionsTable">
            <h:column>
                <f:facet name="header">Status action id</f:facet>
                <h:outputText value="#{_statusActions.statusActionId}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Device device id</f:facet>
                <h:outputText value="#{_statusActions.device.deviceId}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Status action</f:facet>
                <h:outputText value="#{_statusActions.statusAction}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{statusActionsScriptHome.instance.statusActions != null ? 'changeParent' : 'selectParent'}" value="#{statusActionsScriptHome.instance.statusActions != null ? 'Change' : 'Select'} statusActions"
                       view="/StatusActionsList.xhtml">
                <f:param name="from" value="StatusActionsScriptEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>

    <rich:tab label="Status script parmses">
        <h:form styleClass="association" id="statusScriptParmsesChildren">

            <h:outputText value="There are no statusScriptParmses associated with this statusActionsScript."
                       rendered="#{empty statusActionsScriptHome.statusScriptParmses}"/>

            <rich:dataTable value="#{statusActionsScriptHome.statusScriptParmses}"
                           var="_statusScriptParms"
                      rendered="#{not empty statusActionsScriptHome.statusScriptParmses}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="statusScriptParmsesTable">
                <rich:column sortBy="#{_statusScriptParms.statusScriptParmsId}">
                    <f:facet name="header">Status script parms id</f:facet>
                    <h:outputText value="#{_statusScriptParms.statusScriptParmsId}"/>
                </rich:column>
                <rich:column sortBy="#{_statusScriptParms.scriptParmName}">
                    <f:facet name="header">Script parm name</f:facet>
                    <h:outputText value="#{_statusScriptParms.scriptParmName}"/>
                </rich:column>
                <rich:column sortBy="#{_statusScriptParms.scriptParmValue}">
                    <f:facet name="header">Script parm value</f:facet>
                    <h:outputText value="#{_statusScriptParms.scriptParmValue}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{statusActionsScriptHome.managed}" id="statusScriptParmses">
        <div class="actionButtons">
            <s:button id="addstatusScriptParms"
                   value="Add statusScriptParms"
                    view="/StatusScriptParmsEdit.xhtml"
             propagation="none">
                 <f:param name="statusActionsScriptStatusActionsScriptId"
                         value="#{statusActionsScriptHome.instance.statusActionsScriptId}"/>
                 <f:param name="statusScriptParmsFrom" value="StatusActionsScript"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
